function myCarousel(ID,HEIGHT,WIDTH,pageControl )
{
	var carousel = document.getElementById(ID);
	var cWidth = WIDTH;
	var cHeight = HEIGHT;
	var imgs = document.querySelectorAll("#"+ID+">a>img");
	for (var i = 0;i<imgs.length;i++) 
	{
		imgs[i].style.left = i*cWidth+"px";
	}
	var page = 0;
	var timer = setInterval(moveLeft,3000);
	function moveLeft()
	{
		page++;
		if(page>imgs.length-1){
			page = imgs.length-1;
		}
		move();
	}
	function moveRight()
	{
		page--;
		if(page<0)
		{
			page = 0;
		}
		move();
	}
	function move()
	{
		for (var i = 0;i<imgs.length;i++)
		{
			imgs[i].style.left = (i-page)*cWidth+"px";
		}
		setTimeout(function()
		{
			if(page == imgs.length-1)
			{
				page = 0;
				for (var j = 0;j<imgs.length;j++) 
				{
					imgs[j].style.transition = "none";
				}
				for (var j = 0;j<imgs.length;j++) 
				{
					imgs[j].style.left = (j-page)*cWidth+"px";
				}
				setTimeout(function()
				{
					for (var j = 0;j<imgs.length;j++)
					{
						imgs[j].style.transition = "left 0.7s ease-in-out";
					}
				},100);
			}
			pageC.setPage(page);
		},700);
	}
	var pageC = document.querySelectorAll("#"+ID+" "+"."+pageControl);
	for (var i = 0;i<pageC.length;i++) 
	{
		pageC[i].index = i;
		pageC[i].style.top = "80%";
		pageC[i].style.left = (cWidth/2+i*20)-(pageC.length*10+(pageC.length-1)*10)/2+"px";
		pageC[i].onclick = function(e)
		{
			page = e.target.index;
			move();
			clearInterval(timer);
			timer = setInterval(moveLeft,3000);
		}
	}
	pageC.setPage = function(p)
	{
		//先把所有小白点都变透明
		for (var i = 0;i<this.length;i++) 
		{	
			this[i].style.backgroundColor = "white";
		}
		this[p].style.backgroundColor = "#D4191C";
	}
	pageC.setPage(0);
}




